float sdBox(in vec2 p,in vec2 b){
    vec2 d=abs(p)-b;
    return length(max(d,0.))+min(max(d.x,d.y),0.);
}

float sdCircle(vec2 p,float r){
    return length(p)-r;
}

float opUnion(float d1,float d2){
    return min(d1,d2);
}

float opIntersection(float d1,float d2){
    return max(d1,d2);
}

float opSubtraction(float d1,float d2){
    return max(-d1,d2);
}

void mainImage( out vec4 fragColor, in vec2 fragCoord ){
    vec2 uv = fragCoord.xy / iResolution.xy;

    uv = (uv - .5) * 2.;
    uv.x *= iResolution.x / iResolution.y;

    float d1 = sdCircle(uv, .5);
    float d2 = sdBox(uv, vec2(.6, .3));

    float d = d1;

    d = opSubtraction(d1,d2);

    float c = smoothstep(0., .02, d);
    fragColor = vec4(vec3(c),1.);
}